<template>
  <NConfigProvider
    :theme="sysConfigStore.dark == true ? darkTheme : null"
    :theme-overrides="sysConfigStore.getNaiveUiOverridesTheme()"
    class="w-full h-full"
  >
    <AppProvider>
      <Application>
        <router-view />
      </Application>
    </AppProvider>
  </NConfigProvider>
</template>

<script setup lang="ts">
import AppProvider from '@/components/AppProvider/AppProvider.vue'
import { NConfigProvider, darkTheme } from 'naive-ui'
import Application from '@/components/AppProvider/Application.vue'
import { useSysConfigStore } from './store/modules/sysConfig.store'
const sysConfigStore = useSysConfigStore()
sysConfigStore.initSysConfig()

window.addEventListener('beforeunload', () => {
  sysConfigStore.saveSysConfig()
})
</script>

<style scoped></style>
